<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:quality:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <!--<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()"-->
            <!--shiro:hasPermission="system:quality:edit">-->
            <!--<i class="fa fa-edit"></i> 修改-->
            <!--</a>-->
            <a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:quality:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:quality:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:quality:remove')}]];
    var prefix = ctx + "system/quality";

    $(function () {
        var options = {
            url: prefix + "/list",
            detailUrl: prefix + "/edit/{id}",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "质检单",
            search: false,
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'quality',
                    title: '',
                    visible: false
                },
                {
                    field: 'contractId',
                    title: '合同名称',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return row.contractName;
                    }
                },
                {
                    field: 'projectId',
                    title: '工程名称',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return row.projectName;
                    }
                },
                {
                    field: 'costId',
                    title: '费用名称',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return row.costName;
                    }
                },
                {
                    field: 'price',
                    title: '费用明细',
                    sortable: true
                },
                {
                    field: 'discount',
                    title: '折扣',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.detail(\'' + row.qualityId + '\')"><i class="fa fa-search"></i>查看</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.qualityId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>